import dlRequest from "../index";
import { IAccount, ILoginResult } from "./type";
import { IDataType } from "@/service/types";
enum LoginAPI {
  accountLogin = "/login",
  LoginUserInfo = "/users/",
  UserMenus = "/role/",
}

export function accountLoginRequest(account: IAccount) {
  return dlRequest.post<IDataType<ILoginResult>>({
    url: LoginAPI.accountLogin,
    data: account,
  });
}
export function requestUserInfoById(id: number) {
  return dlRequest.get<IDataType>({
    url: LoginAPI.LoginUserInfo + id,
  });
}
export function requestUserMenuById(id: number) {
  return dlRequest.get<IDataType>({
    url: LoginAPI.UserMenus + id + "/menu",
  });
}
